<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 1-100所有数的平均值
        var sum = 0;
        for (var i = 1; i <= 100; i++) {
            sum = sum + i;
        }
        var result = sum / 100
        console.log(result);
        // 1-100所有奇数和偶数的平均值
        var even = 0;
        var odd = 0;
        for (var a = 1; a <= 100; a++) {
            if (a % 2 == 0) {
                even = even + a;
            } else {
                odd = odd + a;
            }
        }
        console.log('1-100所有偶数和' + even + '\n1-100所有奇数和' + odd);
    </script>
</head>

<body>

</body>

</html>